const Koa = require('koa');
const app = new Koa();
const {sync,Produces,Op} = require('./Model')

// sync();

async function a(){
    let keyword = '11.11';
    console.log(typeof keyword);
    console.log(isNaN(keyword)); 
    
    
    let p = await Produces.findAll({
        where:{
            [Op.or]:[
                {id:isNaN(keyword)?-1:parseInt(keyword)},
                {name:keyword},
                {price:isNaN(keyword)?-1:parseFloat(keyword)},
                {stock:isNaN(keyword)?-1:parseInt(keyword)}       
            ]
        },
        order:[
            ['id']
        ]
    });
    console.log('---------------------------------');
    console.log(p);
}
a();



app.listen(8000,()=>{
    console.log('http://localhost:8000');
})

